// import { http } from "@/utils/http";
// import type { AjaxResult } from "./types";
// import { baseUrlApi } from "./utils";
import { request } from "./utils";

// 查询所有类别
export function listAllRooms() {
  return request({
    url: "/hotel/rooms/listAll",
    method: "get"
  });
}

// 分页条件查询类别
export function listRoomsByPage(params?: QueryParams) {
  return request({
    url: "/hotel/rooms/page",
    method: "get",
    params: params
  });
}

// 根据id查询产品
export function getRoomById(id: number) {
  return request({
    url: "/hotel/rooms/" + id,
    method: "get"
  });
}

// 新增类别
export function addRoom(data: RoomForm) {
  return request({
    url: "/hotel/rooms/add",
    method: "post",
    data: data
  });
}

// 修改类别
export function updateRoom(data: RoomForm) {
  return request({
    url: "/hotel/rooms/update",
    method: "put",
    data: data
  });
}

// 删除类别
export function deleteRoomsBatch(roomsIds: number[]) {
  return request({
    url: "/hotel/rooms/delBatch/" + roomsIds,
    method: "delete"
  });
}
export function getLogin(data: object) {
  return request({
    url: "/hotel/auth/login",
    method: "post",
    data: data
  });
}

// export const listAllRooms = () => {
//   return http.request<AjaxResult>("get", baseUrlApi("/hotel/rooms/listAll"));
// };

// export const listRoomsByPage = (params?: QueryParams) => {
//   return http.request<AjaxResult>("get", baseUrlApi("/hotel/rooms/page"), {
//     params
//   });
// };

// export const getRoomById = (id: number) => {
//   return http.request<AjaxResult>("get", baseUrlApi("/hotel/rooms/" + id));
// };

// export const addRoom = (data: RoomForm) => {
//   return http.request<AjaxResult>("post", baseUrlApi("/hotel/rooms/add"), { data });
// };

// export const updateRoom = (data: RoomForm) => {
//   return http.request<AjaxResult>("put", baseUrlApi("/hotel/rooms/update"), { data });
// };

// export const deleteProduct = (productId: number) => {
//   return http.request<AjaxResult>(
//     "delete",
//     baseUrlApi("/product/" + productId)
//   );
// };

// export const deleteRoomsBatch = (roomsIds: number[]) => {
//   return http.request<AjaxResult>(
//     "delete",
//     baseUrlApi("/hotel/rooms/delBatch/" + roomsIds)
//   );
// };

interface RoomTypesDTO {
  id?: number;
  name?: string;
  image?: string;
  type?: string;
  level?: string;
  beds?: number;
  basicPrice?: number;
}

// 查询参数数据
interface QueryParams {
  pageNum: number;
  pageSize: number;
  roomNumber: string;
  area: number;
  floor: number;
  status: string;
  windows: string;
  towards: string;
  roomTypeId: number;
}

//房间及房型合并数据
interface RoomsDTO {
  id: number;
  roomNumber: string;
  roomTypeId: number;
  status: string;
  floor: number;
  area: number;
  windows: string;
  towards: string;
  description: string;
  name: string;
  image: string;
  type: string;
  level: string;
  beds: number;
  basicPrice: number;
}

// 房间表单数据
interface RoomForm {
  id?: number;
  roomNumber?: string;
  status?: string;
  floor?: number;
  area?: number;
  windows?: string;
  towards?: string;
  roomTypeId?: number;
  description: string;
}

export type { RoomTypesDTO, QueryParams, RoomsDTO, RoomForm };
